package com.cjx.print.utils;

import android.preference.PreferenceManager;

import com.cjx.print.App;

/**
 * Created by cjx on 2019/8/7
 * 说明：程序缓存
 */
public class SPUtils {

    public static void putString(String tag, String value) {
        PreferenceManager.getDefaultSharedPreferences(App.app).edit().putString(tag, value).apply();
    }

    public static String getString(String tag, String value) {
        return PreferenceManager.getDefaultSharedPreferences(App.app).getString(tag, value);
    }

    public static void removeTag(String tag) {
        PreferenceManager.getDefaultSharedPreferences(App.app).edit().remove(tag).apply();
    }


    public static void putBoolean(String tag, boolean value) {
        PreferenceManager.getDefaultSharedPreferences(App.app).edit().putBoolean(tag, value).apply();
    }

    public static boolean getBoolean(String tag, boolean value) {
        return PreferenceManager.getDefaultSharedPreferences(App.app).getBoolean(tag, value);
    }

    public static void putInt(String tag, int value) {
        PreferenceManager.getDefaultSharedPreferences(App.app).edit().putInt(tag, value).apply();
    }

    public static int getInt(String tag, int value) {
        return PreferenceManager.getDefaultSharedPreferences(App.app).getInt(tag, value);
    }

}
